package com.mi.rule.util;

import org.springframework.util.AntPathMatcher;
import org.springframework.util.PathMatcher;

public class StrKit {
    //空返回true
    public static boolean isBlank(Object obj) {
        if (obj == null) {
            return true;
        }
        if (obj instanceof String) {
            return obj.toString().replace(" ", "").trim().equals("");
        }
        return false;
    }

    //空返回true
    public static boolean isNotBlank(Object obj) {
        return !isBlank(obj);
    }

    /**
     * 路由是否匹配
     */
    public static boolean isMatch(String pattern, String uri) {
        PathMatcher matcher = new AntPathMatcher();
        return matcher.match(pattern, uri);
    }
}
